package com.crm.business.crm.mapper;

import cn.hutool.core.lang.Dict;
import com.alibaba.fastjson.JSONObject;
import com.crm.business.utils.BiTimeUtil;
import com.crm.common.crm.entity.PO.BrokenLineData;
import com.crm.common.crm.entity.PO.CrmTimeTableData;
import com.crm.common.crm.entity.VO.CrmContactsInstrumentTableData;
import com.crm.common.crm.entity.VO.CrmDataFromTransfer;
import com.crm.common.ka.core.feign.crm.entity.BiParams;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Repository
public interface CrmInstrumentMapper {

    public List<JSONObject> sellFunnel(Map<String, Object> map);

    public List<String> sellFunnelBusinessList(Map<String, Object> map);

    /**
     * 查询销售简报
     *
     * @param biTimeEntity time
     * @param map          map
     * @return data
     */
    public Map<String, Object> queryBulletin(@Param("time") BiTimeUtil.BiTimeEntity biTimeEntity, @Param("map") Map<String, Object> map);

    /**
     * 遗忘客户提现
     *
     * @param day     天数
     * @param userIds ids
     * @return data
     */
    public Integer forgottenCustomerCount(@Param("day") Integer day, @Param("userIds") List<Long> userIds);

    /**
     * 未联系客户
     *
     * @param userIds ids
     * @return data
     */
    public Integer unContactCustomerCount(@Param("userIds") List<Long> userIds);

    public Map<String, Object> salesTrend(@Param("time") BiTimeUtil.BiTimeEntity entity, @Param("data") JSONObject object);

    /**
     * 客户数据汇总
     *
     * @param entity time
     * @param ids    ids
     * @return data
     */
    public Map<String, Object> dataInfoCustomer(@Param("time") BiTimeUtil.BiTimeEntity entity, @Param("ids") List<Long> ids, @Param("dataFrom") String dataFrom);

    /**
     * 商机数据汇总
     *
     * @param entity time
     * @param ids    ids
     * @return data
     */
    public Map<String, Object> dataInfoBusiness(@Param("time") BiTimeUtil.BiTimeEntity entity, @Param("ids") List<Long> ids);

    /**
     * 合同数据汇总
     *
     * @param entity time
     * @param ids    ids
     * @return data
     */
    public Map<String, Object> dataInfoContract(@Param("time") BiTimeUtil.BiTimeEntity entity, @Param("ids") List<Long> ids, @Param("dataFrom") String dataFrom);

    /**
     * 回款数据汇总
     *
     * @param entity time
     * @param ids    ids
     * @return data
     */
    public Map<String, Object> dataInfoReceivables(@Param("time") BiTimeUtil.BiTimeEntity entity, @Param("ids") List<Long> ids, @Param("dataFrom") String dataFrom);

    /**
     * 回款数据汇总
     *
     * @param entity time
     * @param ids    ids
     * @return data
     */
    public Map<String, Object> dataInfoActivity(@Param("time") BiTimeUtil.BiTimeEntity entity, @Param("ids") List<Long> ids, @Param("dataFrom") String dataFrom);

    /**
     * 业绩指标
     *
     * @param entity time
     * @return data
     */
    public JSONObject queryPerformance(Map<String, Object> entity);

    List<JSONObject> queryRecordCount(@Param("data") Dict kv);

    Integer queryCustomerCount(@Param("ownerUserIds") List<Long> ownerUserIds,
                               @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    Integer queryLeadsCount(@Param("dataFrom") String dataFrom, @Param("ownerUserIds") List<Long> ownerUserIds,
                            @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    Integer queryAddWechatCount(@Param("dataFrom") String dataFrom, @Param("ownerUserIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    Integer queryCustomerApplyCount(@Param("dataFrom") String dataFrom, @Param("ownerUserIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    Integer querySalesAddWechatCount(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    Integer queryCustomerJoinGroupCount(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    Integer queryDealSuccessfulCount(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    Integer queryContactsCount(@Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    Integer queryRepurchaseCount(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    Integer queryTransferIntroductionCount(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    BigDecimal queryContractAmount(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    BigDecimal queryContractPayed(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    BigDecimal queryPayBackAmount(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    BigDecimal queryPayedBackAmount(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    List<Map<String, Object>> queryLeadsStatistics(@Param("time") String time);

    List<Map<String, Object>> queryCustomerStatistics(@Param("time") String time);

    Integer queryLeadsCountForConverted(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    /**
     * 成交客户数
     * @param dataFrom
     * @param userIds
     * @param timeRangeEntity
     * @return
     */
    Integer queryDealCustomerCount(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    Integer queryLeadsCountForNotConverted(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    /**
     * 未成交客户数
     * @param dataFrom
     * @param userIds
     * @param timeRangeEntity
     * @return
     */
    Integer queryNotDealCustomerCount(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    /**
     * 获取当前日期前一年内的数据
     * @return
     */
    List<BrokenLineData> queryBrokenLineData(@Param("tableName") String tableName, @Param("dateTime") String dataTime);

    /**
     * 获取最近8期的数据
     * @return
     */
    List<BrokenLineData> queryDefaultDataByPeriods(@Param("tableName") String tableName, @Param("startPeriods") String startPeriods, @Param("endPeriods") String endPeriods, @Param("periodsCount") Integer periodsCount);

    /**
     * 根据表名，开始期数，结束期数查询数据
     * @param tableName 表名
     * @param startPeriods 开始期数
     * @param endPeriods 结束期数
     * @return
     */
    Integer queryPeriodsCountByPeriods(@Param("tableName") String tableName, @Param("startPeriods") Integer startPeriods, @Param("endPeriods") Integer endPeriods);

    /**
     * 查询有效合同数
     * @param userIds
     * @param timeRangeEntity
     * @return
     */
    Integer queryContractCount(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    /**
     * 查询已成交合同数
     * @param userIds
     * @param timeRangeEntity
     * @return
     */
    Integer queryDealContractCount(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    Integer queryDealContractCountForClass(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("dateTime") String dateTime, @Param("biParams") BiParams biParams);

    /**
     * 日期查询线索总数
     * @param startDate 开始日期
     * @param endDate 结束日期
     * @return
     */
    List<Map<String, Long>> queryLeadsCountByDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("userIds") List<Long> userIds, @Param("dataFrom") String dataFrom);

    /**
     * 期数查询线索总数
     * @param periods 期数
     * @return
     */
    List<Map<String, Long>> queryLeadsCountByPeriods(@Param("periods") List<Integer> periods, @Param("userIds") List<Long> userIds, @Param("dataFrom") String dataFrom);

    /**
     * 查询默认期数
     * @return
     */
    List<Integer> queryDefaultPeriods(@Param("dataFrom") String dataFrom);

    /**
     * 日期查询报课数
     * @param startDate 开始日期
     * @param endDate 结束日期
     * @return
     */
    List<Map<String, Long>> queryBaoKeCountByDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("userIds") List<Long> userIds, @Param("dataFrom") String dataFrom);

    /**
     * 期数查询报课数
     * @param periods
     * @return
     */
    List<Map<String, Long>> queryBaoKeCountByPeriods(@Param("periods") List<Integer> periods, @Param("userIds") List<Long> userIds, @Param("dataFrom") String dataFrom);

    /**
     * 日期查询加微信数
     * @param startDate
     * @param endDate
     * @return
     */
    List<Map<String, Long>> queryAddWechatCountByDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("userIds") List<Long> userIds, @Param("dataFrom") String dataFrom);

    /**
     * 期数查询加微信数
     * @param periods
     * @return
     */
    List<Map<String, Long>> queryAddWechatCountByPeriods(@Param("periods") List<Integer> periods, @Param("userIds") List<Long> userIds, @Param("dataFrom") String dataFrom);

    /**
     * 日期查询加群数
     * @param startDate
     * @param endDate
     * @return
     */
    List<Map<String, Long>> queryAddGroupCountByDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("userIds") List<Long> userIds, @Param("dataFrom") String dataFrom);

    /**
     * 期数查询加群数
     * @param periods
     * @return
     */
    List<Map<String, Long>> queryAddGroupCountByPeriods(@Param("periods") List<Integer> periods, @Param("userIds") List<Long> userIds, @Param("dataFrom") String dataFrom);

    /**
     * 日期查询成交数
     * @param startDate
     * @param endDate
     * @return
     */
    List<Map<String, Long>> queryDealCountByDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("userIds") List<Long> userIds, @Param("dataFrom") String dataFrom);

    /**
     * 期数查询成交数
     * @param periods
     * @return
     */
    List<Map<String, Long>> queryDealCountByPeriods(@Param("periods") List<Integer> periods, @Param("userIds") List<Long> userIds, @Param("dataFrom") String dataFrom);

    /**
     * 日期查询KPI
     * @param startDate
     * @param endDate
     * @return
     */
    List<Map<String, BigDecimal>> queryKPIDataByDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("userIds") List<Long> userIds, @Param("dataFrom") String dataFrom);

    /**
     * 期数查询KPI
     * @param periods
     * @return
     */
    List<Map<String, BigDecimal>> queryKPIDataByPeriods(@Param("periods") List<Integer> periods, @Param("userIds") List<Long> userIds, @Param("dataFrom") String dataFrom);

    /**
     * 表单成交数
     * @param dataFrom
     * @param userIds
     * @param timeRangeEntity
     * @return
     */
    Integer queryDealFormCount(@Param("dataFrom") String dataFrom, @Param("ownerUserIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    /**
     * 根据创建时间获取当天的表单数量
     * @param data
     * @return
     */
    List<JSONObject> queryDaysFormCount(@Param("data") Map<String, Object> data);

    /**
     * 根据创建时间获取当天客服加微信数量
     * @param data
     * @return
     */
    List<JSONObject> queryDaysAddWechatCount(@Param("data") Map<String, Object> data);

    /**
     * 根据创建时间获取当前报课数量
     * @param data
     * @return
     */
    List<JSONObject> queryDaysReportClassCount(@Param("data") Map<String, Object> data);

    List<CrmDataFromTransfer> queryDataFromTransfer(@Param("dataFrom") String dataFrom, @Param("ownerUserIds") List<Long> ownerUserIds,
                                                    @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    /**
     * 查询每日成交数量
     * @param data
     * @return
     */
    Integer queryDaysDealCount(@Param("data") Map<String, Object> data);

    /**
     * 查询联系人信息(排除重修)
     * @param data
     * @return
     */
    Integer queryContactsCountByData(@Param("data") Map<String, Object> data, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    /**
     * 查询联系人数量
     * @param data
     * @return
     */
    Integer queryContactsData(@Param("data") Map<String, Object> data, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    /**
     * 根据不同的查询条件查询不同类型的数据
     * @param data
     * @return
     */
    Integer queryDifferentDataCountByData(@Param("data") Map<String, Object> data, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    /**
     * 根据VIP期数获取训练营期数并查询客户信息
     * @param data
     * @return
     */
    Integer queryCustomerCountByData(@Param("data") Map<String, Object> data, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    /**
     * 获取总派单数
     * @param data
     * @return
     */
    Integer querySendSingleNumCount(@Param("data") Map<String, Object> data, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    /**
     * 获取派单定稿数
     * @param data
     * @return
     */
    Integer queryFinalizedNumCount(@Param("data") Map<String, Object> data, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    /**
     * 获取教学部仪表盘表格数据
     * @param data
     * @return
     */
    List<CrmContactsInstrumentTableData> queryContactsTableData(@Param("data") Map<String, Object> data);

    /******************************教学部仪表盘接口查询**********************************/
    /**
     * 查询联系人休学人数
     * @param data
     * @return
     */
    Integer queryXiuXueContactsData(@Param("data") Map<String, Object> data);

    /**
     * 查询重修人数
     * @param data
     * @return
     */
    Integer queryChongXiuContactsData(@Param("data") Map<String, Object> data);

    /**
     * 转出数据
     * @param data
     * @return
     */
    Integer queryZhuanChuContactsData(@Param("data") Map<String, Object> data);

    /**
     * 转入数据
     * @param data
     * @return
     */
    Integer queryZhuanRuContactsData(@Param("data") Map<String, Object> data);

    /**
     * VIP期数为空，只查询是否转期等于是的数据
     * @param data
     * @return
     */
    Integer queryZhuanQiuData(@Param("data") Map<String, Object> data);

    /**
     * VIP期数为空，值查询是否重修等于是的数据
     * @param data
     * @return
     */
    Integer queryChongXiuData(@Param("data") Map<String, Object> data);

    /**
     * VIP期数不为空，查询重修前期数等于VIP期数的数据
     * @param data
     * @return
     */
    Integer queryChongXiuQianData(@Param("data") Map<String, Object> data);

    /**
     * VIP期数不为空，查询转期前期数等于VIP期数的数据
     * @param data
     * @return
     */
    Integer queryZhuanQiQianData(@Param("data") Map<String, Object> data);

    /**
     * 合同未回款金额
     * @param dataFrom
     * @param userIds 用户Id
     * @param timeRangeEntity
     * @return
     */
    BigDecimal queryContractNotReceivablesAmount(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity);

    /**
     * 实际回款金额
     * @param dataFrom
     * @param userIds
     * @param timeRangeEntity
     * @param biParams
     * @return
     */
    BigDecimal queryActualReceivablesSum(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    /**
     * 查询总表单数
     * @param dataFrom
     * @param userIds
     * @param timeRangeEntity
     * @param biParams
     * @return
     */
    Integer queryAllFormCount(@Param("dataFrom") String dataFrom, @Param("ownerUserIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    Integer queryAllFormCountForClassData(@Param("dataFrom") String dataFrom, @Param("ownerUserIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams, @Param("data") List<CrmTimeTableData> crmTimeTableData);

    /**
     * 查询总线索 已报课
     * @param dataFrom
     * @param userIds
     * @param timeRangeEntity
     * @param biParams
     * @return
     */
    Integer querySignClassLeadsCount(@Param("dataFrom") String dataFrom, @Param("ownerUserIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    /**
     * 已转化客户数
     * @param dataFrom
     * @param userIds
     * @param timeRangeEntity
     * @param biParams
     * @return
     */
    Integer queryLeadsCountForTransFor(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    Integer queryLeadsCountForTransForForClassData(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams, @Param("data") List<CrmTimeTableData> crmTimeTableData);

    /**
     *  回款反推 训练营期数
     * @param dataFrom
     * @param userIds
     * @param timeRangeEntity
     * @param biParams
     * @return
     */
    List<String> querytrainingPeriodsFromReceivables(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    /**
     * 训练营期数 反推 合同成交数
     * @param dataFrom
     * @param userIds
     * @param timeRangeEntity
     * @param biParams
     * @return
     */
    Integer queryDealContractCountForPeriods(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    /**
     * 训练营期数 反推  客户数
     * @param dataFrom
     * @param userIds
     * @param dateTime
     * @param biParams
     * @return
     */
    Integer queryLeadsCountForTransForPeriods(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    Integer queryLeadsCountForTransForPeriodsForClass(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams, @Param("data") List<CrmTimeTableData> crmTimeTableData);

    Integer queryLeadsCountForTransForPeriodsForClassNoTime(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams, @Param("data") List<CrmTimeTableData> crmTimeTableData);

    /**
     * 训练营期数 反推 总表单数
     * @param dataFrom
     * @param userIds
     * @param dateTime
     * @param biParams
     * @return
     */
    Integer queryAllFormCountForPeriods(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    Integer queryAllFormCountForPeriodsForClass(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams, @Param("data") List<CrmTimeTableData> crmTimeTableData);

    Integer queryAllFormCountForPeriodsForClassNoTime(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams, @Param("data") List<CrmTimeTableData> crmTimeTableData);

    /**
     * 训练营期数 反推  总线索数
     * @param dataFrom
     * @param userIds
     * @param dateTime
     * @param biParams
     * @return
     */
    Integer querySignClassLeadsCountForPeriods(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    Integer querySignClassLeadsCountForPeriodsForClass(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams, @Param("data") List<CrmTimeTableData> crmTimeTableData);

    Integer querySignClassLeadsCountForPeriodsForClassNoTime(@Param("dataFrom") String dataFrom, @Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams, @Param("data") List<CrmTimeTableData> crmTimeTableData);

    /**
     * 根据课程排期获取讲师Id
     * @param classId
     * @return
     */
    List<Long> queryTeacherByClassData(@Param("classId") Integer classId);

    /**
     * 根据课程排期获取训练营期数
     * @param classId
     * @return
     */
    List<String> queryTrainingPeriodsByClassData(@Param("classId") Integer classId);

    /**
     * 根据课程排期获取排期信息
     * @param classId
     * @return
     */
    List<CrmTimeTableData> queryTimeTableDataByClassId(@Param("classId") Integer classId);

    BigDecimal queryRefundMoney(@Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    BigDecimal queryOverdueMoney(@Param("userIds") List<Long> userIds, @Param("time") BiTimeUtil.BiTimeEntity timeRangeEntity, @Param("biParams") BiParams biParams);

    public BigDecimal queryPerformanceRefundMoney(Map<String, Object> entity);

    public BigDecimal queryPerformanceOverdueMoney(Map<String, Object> entity);

    /**
     * 线索总数
     * @param userIds
     * @return
     */
    Integer getLeadsNum(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime,@Param("type")Integer type);

    /**
     * 线索总数
     * @param userIds
     * @return
     */
    Integer getLeadsNumNOTransform(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime,@Param("type")Integer type);

    /**
     * 线索总数
     * @param userIds
     * @return
     */
    Integer getLeadsNumTransform(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime,@Param("type")Integer type);

    /**
     * 学员总数
     * @param userIds
     * @return
     */
    Integer getStudentNum(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime,@Param("type")Integer type);

    /**
     * vip学员总数
     * @param userIds
     * @return
     */
    Integer getVipStudentNum(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime,@Param("type")Integer type);


    /**
     * 合同总数
     * @param userIds
     * @return
     */
    Integer getContractNum(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime,@Param("type")Integer type);

    /**
     * 合同金额
     * @param userIds
     * @param startTime
     * @param endTime
     * @return
     */
    BigDecimal getContractMoney(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime);

    /**
     * 账单回款金额
     * @param userIds
     * @param startTime
     * @param endTime
     * @return
     */
    BigDecimal getOrderMoney(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime);

    /**
     * 现金回款金额
     * @param userIds
     * @param startTime
     * @param endTime
     * @return
     */
    BigDecimal getReceivablesMoney(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime);

    /**
     * 首付款回款金额
     * @param userIds
     * @param startTime
     * @param endTime
     * @return
     */
    BigDecimal getFirstReceivablesMoney(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime);

    /**
     * 线下补款金额
     * @param userIds
     * @param startTime
     * @param endTime
     * @return
     */
    BigDecimal getOfflineMoney(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime);
    /**
     * 退款金额
     * @param userIds
     * @param startTime
     * @param endTime
     * @return
     */
    BigDecimal getRefundMoney(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime);

    /**
     * 合同金额排行
     * @param userIds
     * @param startTime
     * @param endTime
     * @return
     */
    List<JSONObject> getContractRank(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime);

    /**
     * 回款金额排行
     * @param userIds
     * @param startTime
     * @param endTime
     * @return
     */
    List<JSONObject> getReceivablesRank(@Param("userIds") List<Long> userIds, @Param("startTime")String startTime ,@Param("endTime")String endTime);

}
